package com.data;

import org.apache.log4j.Logger;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * @author sergiu.marin
 * @since 26.01.2014
 */
public class DBUtils {

    private static final Logger log = Logger.getLogger(DBUtils.class);

    public static Connection getConnection(String driverName, String url, int port, String dbName, String userName, String password) {
            Connection connection = null;
            try {
                Class.forName(driverName);
                // connection = DriverManager.getConnection("jdbc:mysql://" + url + "/" + dbName, userName, password);
                connection = DriverManager.getConnection("jdbc:oracle:thin:@" + url + ":" + port + ":" + dbName, userName, password);
            } catch (Exception e) {
                log.error("An error has occurred: " + e.getMessage());
            }

            return connection;
        }
}
